package java_class_work.week05.SendAndCopy;

import java.io.IOException;
import java.io.PipedOutputStream;

/**
 * @Auther: admin
 * @Date: 2022/10/11 11:21
 * @Description:
 */
public class Send implements Runnable {
    private PipedOutputStream pos;

    public Send() {
        this.pos = new PipedOutputStream();
    }

    public PipedOutputStream getPos() {
        return pos;
    }

    @Override
    public void run() {
        String content = "我是要发送的内容";
        try {
            pos.write(content.getBytes());
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            try {
                pos.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
